import com.blogSystem.article.ArticleApplication;
import com.blogSystem.article.dao.ArticleDao;
import com.blogSystem.article.dao.ArticleMapper;
import com.blogSystem.article.pojo.Article;
import com.blogSystem.article.pojo.Thumbs;
import com.blogSystem.article.python.RunPython;
import com.blogSystem.article.service.ArticleService;
import com.blogSystem.article.service.ThumbsSerivlce;
import com.blogSystem.article.util.Predict;
import com.mysql.jdbc.TimeUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Sort;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import util.SetPriority;

import java.io.IOException;
import java.sql.ClientInfoStatus;
import java.util.*;
import java.util.concurrent.TimeUnit;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ArticleApplication.class)
public class test {


    @Autowired
    private ArticleService articleService;

    @Autowired
    private ArticleDao articleDao;

    @Autowired
    private ThumbsSerivlce thumbsSerivlce;

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired(required = false)
    public void setRedisTemplate(RedisTemplate redisTemplate) {
        RedisSerializer stringSerializer = new StringRedisSerializer();
        redisTemplate.setKeySerializer(stringSerializer);
        redisTemplate.setValueSerializer(stringSerializer);
        redisTemplate.setHashKeySerializer(stringSerializer);
        redisTemplate.setHashValueSerializer(stringSerializer);
        this.redisTemplate = redisTemplate;
    }


    @Test
    public void test1()  {


            List<Article> list=articleService.NotLogMatching();
            int i=0;
            for(Article o:list) {
                i++;
                System.out.println("第" + i + "个：编号：" + o.get_id());
            }
        }

        @Test
  public void test2(){

      List<String> label1=new ArrayList<>();
      List<String> label2=new ArrayList<>();
      label1.add("1");
      label1.add("2");
      label2.add("1");
      label2.add("3");
      Article article1=new Article();
      article1.setLabels(label1);
      Article article2=new Article();
      article2.setLabels(label2);
      article1.setTitle("测试1");
      article2.setTitle("测试2");
      //articleService.save(article1);
     // articleService.save(article2);

        }

}
